import request from "../utils/request";

const api = {
  getProductsList: "/products",
  addProducts: "/products",
  updateProducts: (id) => `/products/${id}`,
  deleteProducts: (id) => `/products/${id}`,
  //   getMenuDetail: (id) => `/menuListByPage/${id}`,
};

export const getProducts = (params = {}) => {
  return request({ url: api.getProductsList, method: "get", params });
};

export const addProducts = (data = {}) => {
  return request({ url: api.addProducts, method: "post", data });
};
export const updateProducts = (data = {}) => {
  return request({ url: api.updateProducts(data.id), method: "put", data });
};
export const deleteProducts = (data = {}) => {
  return request({ url: api.deleteProducts(data.id), method: "DELETE" });
};
